FROM python:3.8-slim

ENV PYTHONUNBUFFERED=1 \
    PYTHONPATH=/app \
    WORKERS=4 \
    MAX_REQUESTS=1000

WORKDIR /app
COPY requirements/prod.txt .
RUN pip install --no-cache-dir -r prod.txt

COPY . .

CMD ["gunicorn", "app.main:app",
     "-k", "uvicorn.workers.UvicornWorker",
     "--workers", "$WORKERS",
     "--max-requests", "$MAX_REQUESTS",
     "--timeout", "120"]